#include "stdafx.h"
#include "neuron.h"
#include "Neuron Form.h"

namespace SimpleGUI
{
	// Constructor and Destructor

	template <class T, class U> Neuron<T, U>::Neuron(nnse::neuron<T, U>^ p)
	: parent(p)
	{
		InitializeComponent();
	};

	template <class T, class U> Neuron<T, U>::~Neuron()
	{
		if (components)
		{
			delete components;
		}
	};

	// GUI Functions

	template <class T, class U> System::Void Neuron<T, U>::view_button_Click(System::Object^  sender, System::EventArgs^  e)
	{
		parent->display_dendrites();
	};

	template <class T, class U> System::Void Neuron<T, U>::form_closed(System::Object^  sender, System::Windows::Forms::FormClosedEventArgs^  e)
	{
		parent->invalidate_form();
	};

	template <class T, class U> System::Void Neuron<T, U>::update_form()
	{
		number_textBox->Text=parent->get_number().ToString();
		NET_textBox->Text=parent->get_NET().ToString();
		OUT_textBox->Text=parent->get_OUT().ToString();
		ERR_textBox->Text=parent->get_ERR().ToString();
		DELTA_textBox->Text=parent->get_DELTA().ToString();
		number_of_dendrites_textBox->Text=parent->get_number_of_dendrites().ToString();
		this->Refresh();
	};

	// Explicit Instantiation

	template ref class Neuron<bool, double>;
	template ref class Neuron<unsigned char, double>;
}
